<% @page_title = "多背一公斤 | #{@user.login}" %>

<% content_for(:sidebar) do %>
  <%= render :partial => 'intro', :locals => {:user => @user} %>
  <br />
  <% if current_user==:false || current_user.id!=@user.id -%>
    <%= link_to "给#{@user.login}发消息", new_message_url(:to => @user.id) %>
  <% end -%>
  
  <p><%= button_to "加为我的友邻", add_user_path(@user.id) if @user.addable?(current_user) %></p>
  
  <h3 class="nt">我的友邻 <%= title_suffix %>
    <span class="h2l">(<%= link_to "全部友邻", neighbors_user_path(@user.id) %>)</span></h3>

  <%= render :partial => "/shared/users", :object => @neighbors %>
  <% if logged_in? && current_user.id == @user.id -%>
    <h4 class="nt"><%= link_to "#{@who_add_me[0].count} 人加我为友邻", who_add_me_user_path(@user.id) %></h4>
  <% end -%>
<% end %>

<h3><%= @user.login %></h3>
<h3 class="nt">我提交的学校信息 <%= title_suffix %></h3>
<% if @schools.size != 0 -%>
  <p>一共提交了<%= @schools.size %>所学校信息(<%= link_to "查看", unconfirmed_schools_user_path(@user.id) %>)，其中<%= @schools.find_all{|s| s.is_validate==true}.size %>已经通过验证(<%= link_to "查看", confirmed_schools_user_path(@user.id) %>)</p>
<% else -%>
  <p>还没有提交学校信息</p>
<% end -%>

<h3 class="nt">我去过的学校 <%= title_suffix %></h3>
<% if @visiteds.empty? -%>
  <span class="tip">还没有</span>
<% else -%>
  <% @visiteds.each do |visited| -%>
    <p><%= visited.visit_at %> <span class="tip">去过</span> <%= link_to visited.school.title, school_path(visited.school.id) %></p>
  <% end -%>
<% end -%>

<h3 class="nt">我分享的照片 <%= title_suffix %></h3>
<div id="photos">
  <% if @photos.empty? -%>
    <span class="tip">还没有</span>
  <% else -%>
    <% @photos.each do |photo| %>
      <%= link_to image_tag(photo.public_filename(:small)), photo_url(photo.id) %>
    <% end %>
  <% end -%>
</div>

<h3 class="nt">我参加的活动 <%= title_suffix %>
  <span class="h2l">(<%= link_to "我发布的活动", published_events_user_url(@user.id) %>)</span></h3>
<% @events.each do |event| -%>
  <%= render :partial => "/events/event", :object => event %>
<% end -%>